#include "GeomNode.h"

GeomNode::GeomNode(void)
{
	SetMaterial(1.0f, 1.0f, 1.0f);
	pGeomMesh = NULL;
	pd3dDevice = NULL;
	adjacency = NULL;
}
GeomNode::GeomNode(const GeomNode& rhs)
{
}

GeomNode& GeomNode::operator=(const GeomNode& rhs)
{
	return *this;
}

GeomNode::~GeomNode(void)
{
	Release();
}
void GeomNode::Release()
{
	delete this;
}
void GeomNode::Update(VertBuffer* pvBuff)
{
	pd3dDevice = pvBuff->GetDevice();
	if(pGeomMesh == NULL) 
		Build();
	pvBuff->AddVerts(pGeomMesh, mtrl);
}

void GeomNode::AddChild(SceneNode* pChild)
{
	//cerr<<"Cant add children to geometry nodes.";
}

void GeomNode::SetMaterial(float red, float green, float blue)
{
	D3DMATERIAL9 pMtrl;
		ZeroMemory(&pMtrl, sizeof(D3DMATERIAL9));
		pMtrl.Diffuse.r = pMtrl.Ambient.r = red;
		pMtrl.Diffuse.g = pMtrl.Ambient.g = green;
		pMtrl.Diffuse.b = pMtrl.Ambient.b = blue;
		pMtrl.Diffuse.a = pMtrl.Ambient.a = 1.0f;
	mtrl = pMtrl;
}
